#ifndef HEAD_H_INCLUDED
#define HEAD_H_INCLUDED

#include <gtk/gtk.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

GtkTreeModel *module1;
GtkWidget *treelist1;//教师基本信息
struct edit e_0;
struct mydelete md;
struct myinsert mi;

//教师基本信息树视图
enum
{
    ID1=0,
    NAME1,
    WORK1,
    DUTY1,
    N1
};

//教师工作量树视图
enum
{
    ID2=0,
    YEAR2,
    KEYAN2,
    BISHE2,
    SHUO_BO2,
    TOTAL2,
    N2
};


//教学工作树视图
enum
{
    ID3=0,
    YEAR3,
    KECHENG3,
    SHOUKEXUESHI3,
    SHIYANXUESHI3,
    XUESHENGRENSHU3,
    BANJI3,
    N3
};

//统计
enum
{
    NAME=0,
    CONTENT,
    N_COLUMN
};

//头指针
struct teacherinfo *head;

//密码
struct password
{
    GtkWidget *entry1_1;
    GtkWidget *window;
    GtkWidget *window1;
    GtkWidget *entry1;
    char pre_password[7];
    char filename[15];
    FILE *fp;
};

//教学工作
struct teachwork
{
    char id[20];
    char year[5];
    char kecheng[40];
    char shouke[5];
    char shiyan[5];
    char renshu[5];
    char banji[40];
    struct teachwork*p1;
};

//教师工作量
struct teacherwork
{
    char id[20];
    char year[5];
    char keyan[10];
    char bishe[5];
    char shuobo[5];
    char zongfen[10];
    struct teachwork* p1;
    struct teacherwork* p2;
};

//教师基本信息
struct teacherinfo
{
    char id[20];
    char name[40];
    char workplace[40];
    char duty[40];
    struct teacherwork* p1;
    struct teacherinfo* p2;
};

//树视图1
struct tree_list1
{
    GtkWidget*list1;
    GtkTreeModel*module1;
    GtkWidget*button1;
};

//树视图1的新增
struct list1_new_add
{
    GtkTreeModel*module1;
    struct teacherinfo**head;
    GtkWidget*entry;
    GtkWidget*entry1;
    GtkWidget*entry2;
    GtkWidget*entry3;
    GtkWidget*window;
};

//树视图1的教师工作量
struct list1_teacherwork
{
    GtkTreeSelection*select;
    struct teacherwork**head2;
    GtkTreeModel*module2;
    GtkWidget*entry;
    GtkWidget*entry1;
    GtkWidget*entry2;
    GtkWidget*entry3;
    GtkWidget*entry4;
    GtkWidget*entry5;
    GtkWidget*window;
    gchar id[30];
};

//树视图2的教学工作
struct list2_teachwork
{
    struct teachwork**head3;
    GtkTreeSelection *select;
    GtkWidget*entry;
    GtkWidget*entry1;
    GtkWidget*entry2;
    GtkWidget*entry3;
    GtkWidget*entry4;
    GtkWidget*entry5;
    GtkWidget*entry6;
    GtkTreeModel*module;
    GtkWidget*window;
    GtkWidget*button;
    gchar id[30];
    gchar year[10];
};

//文件
struct file
{
    GtkWidget*window;
    char*teacherinfo_file;
    char*teacherwork_file;
    char*teachwork_file;
    GtkTreeModel *module;
    GtkWidget *list1;
    GtkWidget *button;
};

//修改
struct edit
{
    GtkWidget *entry;
    GtkWidget *entry1;
    GtkWidget *entry2;
    GtkWidget *entry3;
    GtkWidget *entry4;
    GtkWidget *entry5;
    GtkWidget *entry6;
    GtkTreeSelection *select;
    GtkWidget *window;
    GtkTreeIter*iter;
    struct teacherinfo*p;
    struct teacherwork*p1;
    struct teachwork*p2;
    GtkTreeModel*module;
    GtkTreeModel*module2;
    GtkWidget*treeview;
};

//查询
struct myfind
{
    GtkWidget*entry;
    GtkWidget*window;
    GtkTreeModel*module;
    GtkWidget*treeview;
};

//总科研经费
struct money
{
    char name[30];
    double jingfei;
    struct money*next;
};

//教学总学时
struct mytime
{
    char name[30];
    int time;
    struct mytime*next;
    GtkWidget*entry;
    GtkWidget*entry2;
    GtkWidget*window;
};


//删除
struct mydelete
{
    GtkTreeSelection*select;
    GtkTreeModel*module;
    GtkTreeModel*module2;
    GtkWidget*treeview;
};

//插入
struct myinsert
{
    GtkTreeModel*module1;
    GtkWidget*entry;
    GtkWidget*entry1;
    GtkWidget*entry2;
    GtkWidget*entry3;
    GtkWidget*entry4;
    GtkWidget*entry5;
    GtkWidget*entry6;
    GtkTreeSelection*select;
    GtkWidget*window;
    gchar id[30];
    gchar year[10];
    GtkTreeModel*module2;
    GtkWidget*treeview;
};

//密码确认函数
void pass_check(GtkWidget *button,struct password* data);

//关于对话框
void about_dialog(GtkWidget *dialog,gpointer data);

//破坏组件
void destroy_widget(GtkWidget *widget,GtkWidget*widget2);

//修改密码
void edit_password(GtkWidget*menuitem,struct password*data);

//确认密码修改
void confirm_password(GtkWidget*button,struct password*data);

//添加数据到教师基本信息树视图
void list_data_add1(GtkTreeModel*liststore,struct teacherinfo*p);

//添加数据到教师工作量树视图
void list_data_add2(GtkTreeModel*liststore,struct teacherwork*p);

//添加数据到教学工作树视图
void list_data_add3(GtkTreeModel*liststore,struct teachwork*p);

//创建教师基本信息module
GtkTreeModel* creat_module1(void);

//创建教师工作量module
GtkTreeModel* creat_module2(void);

//创建教学工作module
GtkTreeModel* creat_module3(void);

//添加column到教师基本信息
void arrange_treelist1(GtkWidget*treelist);

//添加column到教师工作量
void arrange_treelist2(GtkWidget*treelist);

//添加column到教学工作
void arrange_treelist3(GtkWidget*treelist);

//新建功能回调函数
void click_new(GtkWidget*menu,struct tree_list1*t);

//树视图1新增的回调函数
void new_add1(GtkWidget*button,struct list1_new_add*l);

//树视图1新增确认的回调函数
void new_confirm1(GtkWidget*button,struct list1_new_add*l);

//树视图1抓取的回调函数
void teacher_work(GtkTreeSelection*selection,GtkWidget*button);

//树视图1教师工作量回调函数
void list1_teacher_work(GtkWidget*button,struct list1_teacherwork*l);

//树视图2新增的回调函数
void new_add2(GtkWidget*button,struct list1_teacherwork*l);

//树视图2新增确认的回调函数
void new_confirm2(GtkWidget*button,struct list1_teacherwork*l);

//树视图2抓取的回调函数
void teach_work(GtkTreeSelection*selection,GtkWidget*button);

//树视图2教学工作回调函数
void list2_teach_work(GtkWidget*button,struct list2_teachwork*l);

//树视图3新增的回调函数
void new_add3(GtkWidget*button,struct list2_teachwork*lt);

//树视图3新增确认的回调函数
void new_confirm3(GtkWidget*button,struct list2_teachwork*l);

//保存文件功能
void save_file(GtkWidget*menu,struct file*s);

//保存函数
void save_to_file(struct file*s);

//打开文件功能
void open_files(GtkWidget*menu,struct file*s);

//打开函数
void open_file(struct file*s);

//按姓名查询
void find_name(GtkWidget*menu,struct myfind*f);

//姓名查询确定按钮
void find_name_confirm(GtkWidget*button,struct myfind*f);

//按编号查询
void find_id(GtkWidget*menu,struct myfind*f);

//按编号查询确定按钮
void find_id_confirm(GtkWidget*button,struct myfind*f);

//统计总科研经费
void count_money(GtkWidget*menu,struct money*m);

//添加数据到总科研经费
void model_data_new1(GtkTreeModel*store,struct money*m);

//创建总科研经费统计模型
GtkTreeModel* create_count_module1(void);

//添加column到总科研经费统计
void arrange_count_view1(GtkWidget* view);

//统计教学总学时
void count_mytime(GtkWidget*menu,struct mytime*m);

//添加数据到教学总学时
void model_data_new2(GtkTreeModel*store,struct mytime*m);

//创建教学总学时统计模型
GtkTreeModel* create_count_module2(void);

//添加column到教学总学时
void arrange_count_view2(GtkWidget* view);

//输入年份
void input_year(GtkWidget*menu,struct mytime*m);

//输入年份及达标线
void input_content(GtkWidget*menu,struct mytime*m);

//统计教学工作量未达标
void count_unqulified(GtkWidget*button,struct mytime*m);

//修改按钮1
void edit_teacherinfo(GtkWidget*button,struct edit*e);

//确认修改按钮1
void edit_confirm1(GtkWidget*button,struct edit*e);

//修改按钮2
void edit_teacherwork(GtkWidget*button,struct edit*e);

//确认修改按钮2
void edit_confirm2(GtkWidget*button,struct edit*e);

//修改按钮3
void edit_teachwork(GtkWidget*button,struct edit*e);

//确认修改按钮3
void edit_confirm3(GtkWidget*button,struct edit*e);

//删除按钮1
void delete_teacherinfo(GtkWidget*button,struct mydelete*m);

//删除按钮2
void delete_teacherwork(GtkWidget*button,struct mydelete*m);

//删除按钮3
void delete_teachwork(GtkWidget*button,struct mydelete*m);

//插入按钮1
void insert_teacherinfo(GtkWidget*button,struct myinsert*m);

//插入按钮确认1
void insert_confirm1(GtkWidget*button,struct myinsert*m);

//插入按钮2
void insert_teacherwork(GtkWidget*button,struct myinsert*m);

//插入按钮确认2
void insert_confirm2(GtkWidget*button,struct myinsert*m);

//插入按钮3
void insert_teachwork(GtkWidget*button,struct myinsert*m);

//插入按钮确认3
void insert_confirm3(GtkWidget*button,struct myinsert*m);
#endif // HEAD_H_INCLUDED
